void main() {
  // firstMethod();
  // getPrint();
  // thirdMethod(1,2);
  // printer1(75, s1: 'hello');
  // printer2(75);
  // printer3(75);
  var result = mysteryMessage('Billy', 'howdy', 'the ranch');
  print(result); // Billy said howdy at the ranch
}

void firstMethod() {
  print('定义了一个方法');
}

String getPrint() {
  return '带有返回值的方法';
}

int thirdMethod(int x, int y) {
  return x + y; //必填带参函数
}

int add(int a, int b) => a + b;

printer1(num n, {String? s1, String? s2}) {
  print(n); // 75
  print(s1); // hello
  print(s2); // null
}

printer2(num n, {String? s1, String? s2}) {
  print(n); // 75
  print(s1); // null
  print(s2); // null
}

printer3(num n, {String s1 = '这是默认S1', String? s2}) {
  print(n); // 75
  print(s1); // 这是默认S1
  print(s2); // null
}

String mysteryMessage(String who, [String? what, String? where]){
  var message = '$who';
  if(what != null && where == null){
    message = '$message said $what';
  } else if (where != null){
    message = '$message said $what at $where';
  }
  return message;
}


